package com.xjgzinfo.usdp.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * 项目文件
 *
 * @author system
 */
@Entity
@Table(name = "app_file")
@org.hibernate.annotations.Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class AppFile implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GenericGenerator(name = "snowFlakeIdGenerator", strategy = "com.xjgzinfo.usdp.domain.util.SnowFlakeIdGenerator")
    @GeneratedValue(generator = "snowFlakeIdGenerator", strategy = GenerationType.SEQUENCE)
    @JsonFormat(shape = JsonFormat.Shape.NUMBER)
    //@GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    /**
     * 文件ID
     */
    @NotNull
    @Column(name = "file_id", nullable = false, unique = true)
    private Long fileId;

    /**
     * 文件名
     */
    @NotNull
    @Column(name = "file_name", nullable = false)
    private String fileName;

    /**
     * 文件下载地址
     */
    @NotNull
    @Column(name = "file_uri", nullable = false)
    private String fileUri;

    /**
     * 源文件名
     */
    @NotNull
    @Column(name = "original_file_name", nullable = false)
    private String originalFileName;

    /**
     * 文件存放地址
     */
    @NotNull
    @Column(name = "file_path", nullable = false)
    private String filePath;

    /**
     * 用户ID
     */
    @NotNull
    @Column(name = "user_id", nullable = false)
    private Long userId;

    // jhipster-needle-entity-add-field - JHipster will add fields here
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Long getFileId() {
        return fileId;
    }

    public void setFileId(Long fileId) {
        this.fileId = fileId;
    }

    public AppFile fileId(Long fileId) {
        this.fileId = fileId;
        return this;
    }

    public String getFileName() {
        return fileName;
    }

    public void setFileName(String fileName) {
        this.fileName = fileName;
    }

    public AppFile fileName(String fileName) {
        this.fileName = fileName;
        return this;
    }

    public String getFileUri() {
        return fileUri;
    }

    public void setFileUri(String fileUri) {
        this.fileUri = fileUri;
    }

    public AppFile fileUri(String fileUri) {
        this.fileUri = fileUri;
        return this;
    }

    public String getOriginalFileName() {
        return originalFileName;
    }

    public void setOriginalFileName(String originalFileName) {
        this.originalFileName = originalFileName;
    }

    public AppFile originalFileName(String originalFileName) {
        this.originalFileName = originalFileName;
        return this;
    }

    public String getFilePath() {
        return filePath;
    }

    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }

    public AppFile filePath(String filePath) {
        this.filePath = filePath;
        return this;
    }

    public Long getUserId() {
        return userId;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public AppFile userId(Long userId) {
        this.userId = userId;
        return this;
    }
    // jhipster-needle-entity-add-getters-setters - JHipster will add getters and setters here

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof AppFile)) {
            return false;
        }
        return id != null && id.equals(((AppFile) o).id);
    }

    @Override
    public int hashCode() {
        return 31;
    }

    // prettier-ignore
    @Override
    public String toString() {
        return "AppFile{" +
                "id=" + getId() +
                ", fileId=" + getFileId() +
                ", fileName='" + getFileName() + "'" +
                ", fileUri='" + getFileUri() + "'" +
                ", originalFileName='" + getOriginalFileName() + "'" +
                ", filePath='" + getFilePath() + "'" +
                ", userId=" + getUserId() +
                "}";
    }
}
